package com.axzhengxin.platform.business.mapper;

import com.axzhengxin.platform.business.domain.BizFlowInfo;
import com.axzhengxin.platform.business.domain.BizFlowInfoVo;
import com.axzhengxin.platform.homePage.domain.SearchParams;
import com.axzhengxin.platform.homePage.domain.StatisticData;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;

import java.util.List;
import java.util.Map;

/**
 * @Author ahzj0005
 * @Date 2021/2/20-10:12
 * 业务流程表操作Mapper
 **/
public interface BizFlowInfoMapper {
    /**
     * 新增流程
     * @param bizFlowInfo
     * @return
     */
    int insertBizFlowInfo(BizFlowInfo bizFlowInfo);


    /**
     * 查询第一条记录
     * @param reqId
     * @param userId
     * @return
     */
    String selectFirstFlowUid(@Param(value = "reqId") String reqId,@Param(value = "userId") String userId);

    /**
     * 获取历史记录
     * @param reqId
     * @param deptId
     * @return
     */
    List<BizFlowInfoVo> getRecordList(@Param(value = "reqId") String reqId,@Param(value = "deptId") String deptId);

    /**
     * 获取部门ID
     * @param userId
     * @return
     */
    String getCurrentDeptId(@Param(value = "userId") Long userId);

    /**
     * 根据flowUid进行修改
     * @param flowUid
     * @return
     */
    int updateByFlowUid(@Param(value = "flowUid") String flowUid,@Param(value = "status") String status);


    /**
     * 待办任务
     * @param searchParams
     * @return
     */
    int getTaskAgentCount(SearchParams searchParams);

    /**
     * 审核
     * @return
     */
    List<StatisticData> getAuditingStatistic();

    /**
     *  根据FlowUid 修改状态和bizType
     * @param map
     */
    void updateFlowInfoBizTypeAndStatus(Map<String,Object> map);

    /**
     * 根据id获取部门ID
     * @param flowUid
     * @return
     */
    String selectDeptIdByFlowUid(String flowUid);

    /**
     * 根据ID获取详情
     * @param flowUid
     * @return
     */
    BizFlowInfo selectBizFlowInfoByFlowUid(String flowUid);

    /**
     * 获取所有待处理的管护人ID
     * @return
     */
    List<String> getAuditingPerson();

}
